#include <iostream>

class Point
{
public:
    Point():x(0),y(0){}
    Point(int x,int y):x(x),y(y){}

    //声明该函数是该类的友元函数
    //friend double distance(const Point& p1,const Point& p2);
    //友元类
    friend class Tool;
private:
    int x;
    int y;
};

class Tool
{
public:
    static double distance(const Point &p1,const Point &p2)
    {
        return sqrt(pow(p1.x - p2.x,2) + pow(p1.y - p2.y,2));
    }

    static double length(const Point &p)
    {
        return sqrt(p.x * p.x + p.y * p.y);
    }
};

int main()
{
    Point p1(1,1);
    Point p2(2,2);
    std::cout<<Tool ::distance(p1,p2)<<std::endl;
    std::cout<<Tool ::length(p1)<<std::endl;
    return 0;
}